// 一个用于包装其他组件的高阶组件，如果主观判断权限校验通过，那么 return props.children就行

import React from "react"
import useAuth from "@/utils/useAuth"
import { history } from "umi"
import {Button} from "antd"
export default (props: any) => {
    let [isLogin, setUsetInfo] = useAuth({})
    if (JSON.stringify(isLogin) !== "{}") {
        return props.children
    } else {
        return (
            <div>
                <h1>请登入！</h1>
                <Button type="primary" onClick={()=>{
                    history.push('/login')
                }}>点击登入</Button>
            </div>
        )
    }
}